//装饰器；有缓存就必须有失效日期
//永久有效还是需要放到服务端；

const cacheMap = new Map();

function enableCache(target,name,descriptor){
    const val = descriptor.value;
    descriptor.value = async function(...args){
        const cachekey = name + JSON.stringify(args);
        if(!cacheMap.get(cacheKey)){
            const cacheValue = Promise.resolve(val.apply(this,args)).catch(_ =>{
                cacheMap.set(cacheKey,null)
            })
            cacheMap.set(cacheKey,cacheValue)
        }
        return cacheMap.get(cachekey);
    }
    return descriptor
}


class PromiseClass {
    @enableCache
    static async getInfo(){}
}